home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iachandler.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-20  |  1.5 KB  |  66 lines  |  [TEXT/KAHL]

  1. /*© Copyright 1988-1992 UserLand Software, Inc.  All Rights Reserved.*/
  2.  
  3. #include "iacinternal.h"
  4.  
  5.  
  6.  
  7.  
  8. Boolean IACinstallhandler (AEEventClass eventclass, AEEventID id, ProcPtr handler) {
  9.     
  10.     register OSErr errcode;
  11.     
  12.     errcode = AEInstallEventHandler (eventclass, id, (EventHandlerProcPtr) handler, 0, false);
  13.     
  14.     IACglobals.errorcode = errcode;
  15.     
  16.     return (errcode == noErr);
  17.     } /*AEinstallhandler*/
  18.     
  19.     
  20. Boolean IACremovehandler (AEEventClass eventclass, AEEventID id, ProcPtr handler) {
  21.  
  22.     register OSErr errcode;
  23.     
  24.     errcode = AERemoveEventHandler (eventclass, id, (EventHandlerProcPtr) handler, false);
  25.     
  26.     IACglobals.errorcode = errcode;
  27.     
  28.     return (errcode == noErr);
  29.     } /*IACremovehandler*/
  30.  
  31.  
  32. Boolean IAChandlerinstalled (OSType vclass, OSType vtoken, Boolean flsystemhandler) {
  33.     
  34.     /*
  35.     return true if there's a handler installed with the indicated class and id.
  36.     
  37.     if flsystemhandler is true, we only consider system event handlers, if false 
  38.     we only consider app-specific handlers.
  39.     */
  40.     
  41.     OSErr ec;
  42.     EventHandlerProcPtr handler;
  43.     long refcon;
  44.     
  45.     ec = AEGetEventHandler (vclass, vtoken, &handler, &refcon, flsystemhandler);
  46.     
  47.     IACglobals.errorcode = ec;
  48.     
  49.     return (ec == noErr);
  50.     } /*IAChandlerinstalled*/
  51.  
  52.  
  53. Boolean IACinstallcoercionhandler (DescType fromtype, DescType totype, ProcPtr handler) {
  54.     
  55.     register OSErr errcode;
  56.     
  57.     errcode = AEInstallCoercionHandler (fromtype, totype, handler, (long) 0, false, false);
  58.     
  59.     IACglobals.errorcode = errcode;
  60.  
  61.     return (errcode == noErr);
  62.     } /*IACinstallcoercionhandler*/
  63.  
  64.  
  65.  
  66.